1. Field of Invention
The present invention relates generally to computing systems which use virtual machines. More particularly, the present invention relates to a technique increasing overall virtual machine performance.
2. Description of the Related Art
The Java™ programming language is an object-based high level programming language developed by Sun Microsystems, Inc. of Palo Alto, Calif. The Java™ programming language is designed to be portable enough to be executed on a wide range of computers which include, but are not limited to, small personal computing device and supercomputers.
Programs written in the Java™ programming language, i.e., Java™ programs, are compiled into class files which include virtual machine instructions, e.g., bytecodes, for a Java™ virtual machine. In essence, a Java™ virtual machine is a software emulator of a “generic” computer. Virtual machine instructions may be run, unmodified, on substantially any computer system that has a virtual machine implementation. As such, virtual machines are both portable and flexible. In addition, other programming languages may be compiled into Java™ virtual machine instructions and executed by a Java™ virtual machine.
A Java™ virtual machine has an interpreter that is executed as an interpreter program, i.e., software. Conventional interpreters are arranged to decode and to execute the virtual machine instructions of an interpreted program one instruction at a time during execution. Compilers, which are also associated with a virtual machine, decode source code into native machine instructions prior to execution so that decoding it is not necessary to perform decoding during execution. Conventional interpreters decode each instruction each time the instruction is executed. In other words, conventional interpreters repeatedly decode each instruction each time the instruction is executed. As such, since an instruction is decoded by a conventional interpreter each time the instruction is encountered, execution of interpreted programs is typically substantially slower than execution of compiled programs since the execution of compile programs may occur on an associated native machine or computer system without necessitating decoding.
As the popularity of small computing devices, e.g., cellular telephones and personal digital assistants, which execute code written in the Java™ programming language increases, the demand for better performing Java™ virtual machines is also increasing. One conventional method for increasing the execution speed and, hence the performance, of Java™-based interpreted programs of virtual machine instructions involves utilizes a just-in-time (JIT) compiler to translate Java™ bytecodes into native code substantially “on-the-fly.” A JIT compiler compiles an entire Java™ function just before the Java™ function is called. However, native code generated by a JIT compiler does not always run faster than code executed by an interpreter. For example, if the interpreter is not spending the majority of its time decoding the Java™ virtual machine instructions, then compiling the instructions with a JIT compiler may not increase the execution speed. In some instances, execution of the virtual machine may even be compromised by utilizing the JIT compiler, e.g., if the overhead associated with compiling the instructions is more than the overhead associated with interpreting the instructions.
In general, at least parts of a JIT compiler are platform specific. As a result, if a virtual machine with a JIT compiler is to be ported to a different platform, at least the platform-specific parts of the JIT compiler, e.g., a code generator, must be rewritten to accommodate the new platform. Rewriting platform-specific parts of a JIT compiler may be a time-consuming task.
Further, a JIT compiler is often associated with a substantial amount of code. That is, JIT compilers often require a relatively significant portion of memory. Even a “simple” JIT compiler such as a JIT compiler which is substantially arranged only to generate code and not to perform extensive optimizations, requires more memory than is typically available in small devices. As will be appreciated by those skilled in the art, a standard JIT compiler may require memory to store an intermediate representation of compiled code, to store JIT compiler code and data, and to store native code corresponding to entire Java™ methods.
Therefore, what is desired is a technique for reliably increasing the performance of virtual machines. More particularly, what is needed is a method and an apparatus for increasing the performance of virtual machines in environments with limited memory resources.